<link href="{{$s_path}}/js/swfupload/css/swfupload.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="{{$s_path}}/js/swfupload/swfupload.js"></script>
<script type="text/javascript" src="{{$s_path}}/js/swfupload/swfupload.queue.js"></script>
<script type="text/javascript" src="{{$s_path}}/js/swfupload/fileprogress.js"></script>
<script type="text/javascript" src="{{$s_path}}/js/swfupload/handlers.js"></script>

<script type="text/javascript">

function swfUpload(parm){
		var index = parm.index;
		
		
		var html = '<div class="upload_box " id="upload_box_'+index+'"><div id="progress_'+index+'"  class="fieldset flash">  </div><div id="thumbnails_'+index+'" class="thumbnails"></div><div id="btnCancel_'+index+'"></div></div>';
		
		var res_obj = $("#"+parm.button_id+"_res");
		res_obj.html(html);
		
		var def = $("#"+parm.button_id+"_default").html() || "";
		if(def)
		{
			var def = $.parseJSON(def);
		
			for(var i=0;i<def.length;i++)
			{
				setImg(def[i],parm);
				
			}
			setInput(parm);
		}
		
		swfu = new SWFUpload({
                    flash_url : s_path+"/js/swfupload/swfupload.swf",
					flash9_url : s_path+"/js/swfupload/swfupload_fp9.swf",
					upload_url: sep+"/ajax.php",
					post_params: {
						"swfupload" : "1",
						'act':'uploader'
					},
					file_size_limit : parm.size+" MB",
					file_types : parm.type || "*.*",
					file_types_description : "选择文件",
					file_upload_limit :parm.limit || 100,
					file_queue_limit : 0,
					
	
					// Button settings
					button_image_url: s_path+"/js/swfupload/images/select_files.png",
					button_width: "110",
					button_height: "29",
					button_placeholder_id: parm.button_id || "spanButtonPlaceHolder",
					button_text: '<span class=\"button\" style=\"color:blue\"><\/span>',
					
					// The event handler functions are defined in handlers.js
					swfupload_preload_handler : preLoad,
					swfupload_load_failed_handler : loadFailed,
					file_queued_handler : fileQueued,
					file_queue_error_handler : fileQueueError,
					file_dialog_complete_handler : fileDialogComplete,
					upload_start_handler : uploadStart,
					upload_progress_handler : uploadProgress,
					upload_error_handler : uploadError,
					upload_success_handler : uploadSuccess,
					upload_complete_handler : uploadComplete,
					queue_complete_handler : queueComplete,	// Queue plugin event,
				 	 // Debug Settings
					 custom_settings : {
						progressTarget :  'progress_'+index+'',
						cancelButtonId : 'btnCancel_'+index+'',
						thumbnails:'thumbnails_'+index+'',
						divStatus:'divStatus_'+index+'',
						parm:parm
						
	
					},
					
                    debug: parm.debug || false
                });
				
				
				return swfu;


}

           

          
</script>
